﻿using Domain.Flow;
using MediatR;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using U.B.DoMain.rabbitsAAA;
using U.B.ErrorCode;
using U.B.ReadApi.Command.Raddit.BW;
using U.B.ReadApi.Dto;

namespace U.B.ReadApi.Controllers
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class rabbitController : ControllerBase
    {
        public readonly IMediator _mediator;
        public rabbitController(IMediator mediator)
        {
            _mediator = mediator;
        }
        /// <summary>
        /// 获取商品信息列表
        /// </summary>
        /// <param name="command"></param>
        /// <returns></returns>
        [HttpGet]
        public Apipage<ProductDto> GetProductList([FromQuery] GetrabbitCommand command)
        {
            return _mediator.Send(command).Result;

        }
        /// <summary>
        /// 获取商品分类
        /// </summary>
        /// <param name="command"></param>
        /// <returns></returns>
        [HttpGet]
        public ApiResult<List<ProductClass>>GetProductClass([FromQuery]GetproductclassCommand command)
        {
            return _mediator.Send(command).Result;
        }
        /// <summary>
        /// 获取商品详情
        /// </summary>
        /// <param name="command"></param>
        /// <returns></returns>
        [HttpGet]
        public ApiResult<Product>GetProductSList([FromQuery] GetproductCommand command)
        {
            return _mediator.Send(command).Result;
        }
        /// <summary>
        /// 详情页面页首
        /// </summary>
        /// <param name="command"></param>
        /// <returns></returns>
        /// 
        [HttpGet]
        public ApiResult<ProductDto> GetProductDetail([FromQuery] GetproductSSCommand command)
        {
             return _mediator.Send(command).Result;
        }
        /// <summary>
        /// 获取农场列表
        /// </summary>
        /// <param name="command"></param>
        /// <returns></returns>
        [HttpGet]
        public ApiResult<Farm>GetFarmList([FromQuery] GetFarmCommand command)
        {
            return _mediator.Send(command).Result;
        }
        /// <summary>
        /// 获取健康信息
        /// </summary>
        /// <param name="command"></param>
        /// <returns></returns>
        [HttpGet]
        public ApiResult<Immune> GetImmune([FromQuery] GetImmuneCommand command)
        {
            return _mediator.Send(command).Result;
        }
        /// <summary>
        /// 获取企业信息
        /// </summary>
        /// <param name="command"></param>
        /// <returns></returns>
        /// 
        [HttpGet]
        public ApiResult<Firm> GetFirm([FromQuery] GetFirmCommand command)
        {
            return _mediator.Send(command).Result;
        }
        /// <summary>
        /// 屠宰获取事件
        /// </summary>
        /// <param name="command"></param>
        /// <returns></returns>
        [HttpGet]
        public ApiResult<Kill>GetKill([FromQuery] GetKillCommand command)
        {
            return _mediator.Send(command).Result;
        }
        /// <summary>
        /// 获取供应商信息
        /// </summary>
        /// <param name="command"></param>
        /// <returns></returns>
        [HttpGet] 
        public ApiResult<Supplier> GetSupplier([FromQuery] GetSupplierCommand command)
        {
            return _mediator.Send(command).Result;
        }
        /// <summary>
        /// 获取图片
        /// </summary>
        /// <param name="command"></param>
        /// <returns></returns>
        [HttpGet]
        public ApiResult<Picture> GetPicture([FromQuery] GetPicCommand command)
        {
            return _mediator.Send(command).Result;
        }
        /// <summary>
        /// 获取图片动检证
        /// </summary>
        /// <param name="command"></param>
        /// <returns></returns>
        /// 
        [HttpGet]
        public ApiResult<PICA>GetPICA([FromQuery] GetPicACommand command)
        {
            return _mediator.Send(command).Result;
        }

    }
}
